package com.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@EnableAutoConfiguration
@Controller
//配置注解，需要set，get方法
@ConfigurationProperties(prefix="book")
public class BookController {
	
//	@Value("${book.author}")
	private String author;
	
//	@Value("${book.name}")
	private String name;
	@Value("${book.price}")
	private String price;
											//localhost:8088/bookInfo
	@RequestMapping("/bookInfo")
	@ResponseBody
	public String showInfo(){
		return author+":"+name;
	}
	@RequestMapping("/bookInfo2")
	@ResponseBody
	public String showInfo2(){
		return price;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public static void main(String[] args) {
		
			SpringApplication.run(BookController.class, args);
	
	}
}
